package com.fub.positioning;

import com.fub.guidance.Point;

import junit.framework.TestCase;

public class MapMatcherTest extends TestCase {
	private MapMatcher mapMatcher;

	protected void setUp() throws Exception {
		super.setUp();
		this.mapMatcher = new MapMatcher();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testGetPointOnEdge() {
		int z = 0;
		Point p1 = new Point(0, 0, z);
		Point p2 = new Point(4, 0, z);
		Point p3 = new Point(2, 2, z);

		float[] matched = this.mapMatcher.getPointOnEdge(p1, p2, p3);
		assertEquals(2, matched[0]);
		assertEquals(0, matched[1]);
	}

	public void testDiagonalGetPointOnEdge() {
		int z = 0;
		Point p1 = new Point(0, 2, z);
		Point p2 = new Point(4, 0, z);
		Point p3 = new Point(3, 2, z);

		float[] matched = this.mapMatcher.getPointOnEdge(p1, p2, p3);
		assertEquals(2, matched[0]);
		assertEquals(2, matched[1]);
	}

}
